<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>项目报价方案</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>

<script type="text/javascript">
	var prjId='${prjId}';
	var grid = null;
	var buOrgCd = '${buOrgCd}';
	var insCode = '${insCode}';
	$(function () {
		initGrid();//grid
	});
	
	//初始化列表
	function initGrid(){
		var params = {};
		params.prjId = prjId;
		$("#grid").ligerGrid({
			url: '<%=path%>/project/prjQuatPrpsCfgM/getPrjQuatPrpsByConditon.do?prjId='+prjId,
	    	method : 'get',
	        columns: [
	            { display: '方案配置名称', name: 'prpsCfgNm', minWidth: 100, enabledSort:true},
	            { display: '所属机构', name: 'buOrgCdNm', minWidth: 150, enabledSort:true},
	            { display: '业务类型', name: 'prjQuatPrpsAttrPageVO.bizTypCdNm', minWidth: 100, enabledSort:true},
	          /*   { display: '项目类型', name: 'prjQuatPrpsAttrPageVO.prjTypCdNm', minWidth: 100, enabledSort:true}, */
	            { display: '有效期', minWidth: 150,
	            	render: function (rowdata, rowindex, value){
	            		var expStDt = new Date(rowdata.expStDt);
	    	    		var expStDtStr = DateUtils.formatDate(expStDt, DateUtils.YYYY_MM_DD);
	            		var expEndDt = new Date(rowdata.expEndDt);
	    	    		var expEndDtStr = DateUtils.formatDate(expEndDt, DateUtils.YYYY_MM_DD);
			            return expStDtStr + " / " + expEndDtStr;
	            	}	
	            },
	            {
	                display: '操作',
	                isSort: false,
	                width: 200,
	                render: function (rowdata, rowindex, value){
	                	var h = '';
	                        h+='<a class="sq-button-hasicon" href="javascript:addPrjQuatPrps(';
	                        h+="'"+rowdata.id+"',";
	                        h+="'"+ProjectConstant.CODE_PAY_QUAT_PRPS_QUOTE+"',";
	                        h+="'"+rowdata.payWayCd+"'";
	                        h+=')"><i class="sqBtnIco_3"></i>报价版方案</a>';
	             /*            h+='<a class="sq-button-hasicon" href="javascript:addPrjQuatPrps(';
	                        h+="'"+rowdata.id+"',";
	                        h+="'"+ProjectConstant.CODE_PAY_QUAT_PRPS_OFFICIAL+"'";
	                        h+=')"><i class="sqBtnIco_3"></i> 录入版方案</a>';  */
	                    return h;
	                }
	            }
	        ],
	        pageSize:100,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        heightDiff:-2,
	        checkbox:false,
	        allowUnSelectRow: true,
            alternatingRow: false,
	        rownumbers:true,
	        usePagerOnLessPagesize: true,
	    });
		grid = liger.get("grid");
		grid.setHeight(300);
		
	}
	//格式化为人民币格式
	function renderAmt(rowdata, rowindex, value) {
        var h="￥" + FormatMoney(rowdata.SQMoney)
        return h;
    }

	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value&&value!=''){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		}
		return dateStr;
	}
	
	//添加
	function addPrjQuatPrps(prpsCfgId,quatType,payWayCd){
		var callback = frameElement.dialog.get("callback");
		if(buOrgCd==ProjectConstant.CODE_BU_ORG_CD_CAR||buOrgCd==ProjectConstant.CODE_BU_ORG_CD_ZC){
			if(payWayCd==ProjectConstant.CODE_MULTI__STEP_INTER_GH){
		    parent.Add_navTab('tab_project_prd_detail','添加方案','<%=path%>/project/prjquatprps/toAddCarBankPage.do?prpsCfgId='+prpsCfgId+'&&prjId='+prjId+'&&prpsTypCd='+quatType,callback);
			}else{
	         parent.Add_navTab('tab_project_prd_detail','添加方案','<%=path%>/project/prjquatprps/toAddCarPage.do?prpsCfgId='+prpsCfgId+'&&prjId='+prjId+'&&prpsTypCd='+quatType,callback);
			} 
		}else if(buOrgCd==ProjectConstant.CODE_BU_ORG_CD_XNY){
			if(insCode&&insCode==ProjectConstant.PRJ_INS_CODE_PSD){
				parent.Add_navTab('tab_project_prd_detail','添加方案','<%=path%>/project/prjquatprps/toAddPage.do?prpsCfgId='+prpsCfgId+'&&prjId='+prjId+'&&prpsTypCd='+quatType,callback);
			}else{
				parent.Add_navTab('tab_project_prd_detail','添加方案','<%=path%>/project/prjquatprps/toAddNewEngeryPage.do?prpsCfgId='+prpsCfgId+'&&prjId='+prjId+'&&prpsTypCd='+quatType,callback);
			}
		}else if(buOrgCd==ProjectConstant.CODE_BU_ORG_CD_ZK&&insCode&&insCode==ProjectConstant.PRJ_INS_CODE_ICBC){
			parent.Add_navTab('tab_project_prd_detail','添加方案','<%=path%>/project/prjquatprps/toAddZKBankPage.do?prpsCfgId='+prpsCfgId+'&&prjId='+prjId+'&&prpsTypCd='+quatType,callback);
		}else{
			parent.Add_navTab('tab_project_prd_detail','添加方案','<%=path%>/project/prjquatprps/toAddPage.do?prpsCfgId='+prpsCfgId+'&&prjId='+prjId+'&&prpsTypCd='+quatType,callback);
		}
		frameElement.dialog.close();
	}

	function iframeResize () {
	    if (parent.mainApp) {
	        parent.mainApp.parentTab.onResize();
	    };
	}
</script>

<body class="iframeBody">
	<div class="Wrapper">
        <div>
           <div id="pageInTab" class="pageInTab">
<div id="grid" class="sq-grid"></div>
</div>
	</div>
		</div>
			</div>
</body>
</html>